package com.ruoyi.project.service;

import java.math.BigDecimal;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mapper.SubjectMapper;
import com.ruoyi.project.domain.Subject;
import com.ruoyi.project.service.ISubjectService;
import com.ruoyi.common.support.Convert;

/**
 * 教学科目 服务层实现
 * 
 * @author ruoyi
 * @date 2018-11-01
 */
@Service
public class SubjectServiceImpl implements ISubjectService 
{
	@Autowired
	private SubjectMapper subjectMapper;

	/**
     * 查询教学科目信息
     * 
     * @param subjectId 教学科目ID
     * @return 教学科目信息
     */
    @Override
	public Subject selectSubjectById(Long subjectId)
	{
	    return subjectMapper.selectSubjectById(subjectId);
	}
	
	/**
     * 查询教学科目列表
     * 
     * @param subject 教学科目信息
     * @return 教学科目集合
     */
	@Override
	public List<Subject> selectSubjectList(Subject subject)
	{
	    return subjectMapper.selectSubjectList(subject);
	}
	
    /**
     * 新增教学科目
     * 
     * @param subject 教学科目信息
     * @return 结果
     */
	@Override
	public int insertSubject(Subject subject)
	{
	    return subjectMapper.insertSubject(subject);
	}
	
	/**
     * 修改教学科目
     * 
     * @param subject 教学科目信息
     * @return 结果
     */
	@Override
	public int updateSubject(Subject subject)
	{
	    return subjectMapper.updateSubject(subject);
	}

	/**
     * 删除教学科目对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteSubjectByIds(String ids)
	{
		return subjectMapper.deleteSubjectByIds(Convert.toStrArray(ids));
	}

	/**
	 * 根据价格查询教学科目
	 * @param price
	 * @return
	 */
	@Override
	public List<Subject> selectSubjectprice (BigDecimal price){
		Subject subject=new Subject();
		subject.setPrice(price);
		return subjectMapper.selectSubjectList(subject);
	}

	/**
	 *根据级别查询教学科目
	 * @param level
	 * @return
	 */
	@Override
	public List<Subject> selectSubjectlevel (String level){
		Subject subject=new Subject();
		subject.setLevel(level);
		return subjectMapper.selectSubjectList(subject);
	}


}
